package com.example.shiwuyouproject.ui.modelview

import androidx.lifecycle.MutableLiveData
import com.example.shiwuyouproject.base.BaseViewModel
import com.example.shiwuyouproject.ui.bean.GetMessageListsBean

class MessageViewModel:BaseViewModel() {
    private val loginRepository by lazy { RetrofitClient.getApiService() }
    /**
     * 首页-获取首页数据
     */
    val getMessageListsStatus = MutableLiveData<MutableList<GetMessageListsBean>>()
    fun getMessageLists(page:String){
        launch(
            block = {
                val codeStatus = loginRepository.getMessageLists(page)
                getMessageListsStatus.value=codeStatus.result().data.data
            },
            error = {
            },
            cancel = {

            },
            showErrorToast = false
        )
    }
}